#override("title")
SpringWind - 污染源列表
#end
#override("css")
<link href="#springUrl('/static/css/plugins/bootstrap-table/bootstrap-table.min.css')" rel="stylesheet">
#end
#override("breadcrumb")
<li><a>评分系统</a></li><li class="active"><strong>污染源列表</strong></li>
#end
#override("content")
<div class="row">
	<div class="ibox-content text-left form-inline" style="background: #F3F3F4;">
		<div class="input-group">
			<label class="text-left">污染源id:<input type="text" class=""></label>
		</div>&nbsp;
		<div class="input-group">
			<label  class="text-left">污染源名称:<input type="text" class=""></label>
		</div>
		<div class="input-group">
			<button type="button" class="btn btn-info" onclick="null">查询</button>
		</div>
		<div class="input-group">
			<button class="btn btn-primary" onclick="addSource()" type="button">添加</button>
		</div>
	</div>

</div>
<div class="row">
    <div class="col-sm-12">
        <table id="dataTable"></table>
    </div>
</div>
#end
#override("js")
<script src="#springUrl('/static/js/plugins/bootstrap-table/bootstrap-table.min.js')"></script>
<script src="#springUrl('/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js')"></script>
<script src="#springUrl('/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js')"></script>
<script src="#springUrl('/static/plugins/layer-v2.2/layer/layer.js')"></script>
<script src="#springUrl('/static/js/base_list.js')"></script>
<script src="#springUrl('/static/js/common.js')"></script>
<script type="text/javascript">
var dataUrl="#springUrl('/perm/role/getRoleList.html')";
var dataColumns = [{
		field: 'id',
		title: '来源编号'
	}, {
		field: 'source_name',
		title: '来源名称'
	}, {
		field: 'source_type',
		title: '来源类型'
	},
    {
        field: 'quantity',
        title: '层'
    }, {
        field: 'mig_path',
        title: '污染废水来源'
    }, {
        field: 'ground_water',
        title: '地下水'
    }, {
        field: 'surface_water',
        title: '地表水'
    }, {
        field: 'air',
        title: '空气'
    }, {
        field: 'soil',
        title: '土壤'
    }, {
        field: 'aoc',
        title: 'AOC标识'
    },  {
    title: '操作',
    formatter: function (value, row, index) {
        var id = row.id;
        return '<a class="btn btn-xs btn-warning" onclick="editSource(' + "'" + id + "'" + ')"><i class="fa fa-pencil"></i>查看</a> '
            + '<a class="btn btn-xs btn-success" onclick=""><i class="fa fa-edit"></i>分数评比</a>'
        + '<a class="btn btn-xs btn-danger" onclick="delSource(' + "'" + id + "'" + ')"><i class="fa fa-remove"></i>删除</a> ';
    }
}];
function dataQueryParams(params) {
    return {
        _size: params.limit,  //页面大小
        _index: params.offset //页码
    };
}
function addSource() {
    var title = "新增污染源";
    var url = "#springUrl('/source/add.html')";
    layer.open({
        type: 2,
        title: title,
        shadeClose: true,
        shade: 0.8,
        area: ['550px', '430px'],
        fix: false,
        maxmin: false,
        content: url
    });
}
function delSource(id) {
    //询问框
    layer.confirm('确定删除吗？', {
        btn: ['确定', '取消'] //按钮
    }, function () {
        $.ajax({
            type: "POST",
            url: "#",
            datatype: "text",
            success: function (data) {
                if(data == 'true'){
                    $('#dataTable').bootstrapTable('refresh',{url:dataUrl});
                }
                layer.closeAll();
            }
        });
    }, function () {
        return;
    });
}
function editSource(id) {
   	var title = "查看污染源";
   	var url = "#springUrl('/source/edit.html')";
   	if(id!=null){
   		url = url + "?id=" + id;
   	}
    layer.open({
        type: 2,
        title: title,
        shadeClose: true,
        shade: 0.8,
        area: ['550px', '430px'],
        fix: false,
        maxmin: true,
        content: url
    });
}
</script>
#end
#extends("/common/framework.html")
